//using System;
//using System.Text;
//using System.IO;
//using System.Xml;
//using NUnit.Framework;
//using Google.GData.Client;
//using Google.GData.Apps;
//using Google.GData.Extensions;
//using Google.GData.Spreadsheets;

//using System.Diagnostics;

//using System.Data;
//using System.Configuration;
//using System.Collections;



//namespace TestCases.GoogleFinance
//{
//    [TestFixture]
//    [Category("GoogleApps")]
//    public class TestFinance
//    {
//        Service finance;
//        public TestFinance()
//        {

//            //Google.GData.Client.GoogleAuthentication.Password

//        }
//        [Test]
//        public void Authenticate()
//        {
//            String next = "http://www.example.com/welcome.html";
//            String scope = "http://finance.google.com/finance/feeds/";
//            bool secure = false;
//            bool session = true;
//            String authSubLogin = AuthSubUtil.getRequestUrl(next, scope, secure, session);
//            Uri nextURI = new Uri(next);

//            String token = AuthSubUtil.getTokenFromReply(nextURI);
//            String sessionToken = AuthSubUtil.exchangeForSessionToken(token, null);

//            //FinanceService myService = new FinanceService("exampleCo-exampleApp-1");
//            //myService.setUserCredentials("user@domain.com",
//            //  "secretPassword");



//        }
//        [Test]
//        public void FinanceTEst()
//        {
//            // Set the credentials
//            this.finance = new Service("finance", "company-software-1.2");
//            this.finance.setUserCredentials("1154-114@onlinehome.de", "edgarmaass");

//            // Setup the query
//            FeedQuery query = new FeedQuery();
//            query.Uri = new Uri("http://finance.google.com/finance/feeds/default/portfolios?returns=true");

//            // Perform the query
//            AtomFeed feed = this.finance.Query(query);
//            //status = true;

//            // Dump to XML file
//            XmlWriter writer = new XmlTextWriter(@"c:\tmp\Portfolios.xml", Encoding.UTF8);
            
//            feed.SaveToXml(writer);
            
//            writer.Close();

//  //          //AtomFeed returnFeed = this.finance.Query(query);
//  //          //--------
//  //          string feedUrl = "http://finance.google.com/finance/feeds/default/portfolios/1/positions"
//  //          Feed positionFeed = service.getFeed(new URL(feedUrl), PositionFeed.class);
//  //printBasicFeedDetails(positionFeed);
//  //for (int i = 0; i < positionFeed.getEntries().size(); i++) {
//  //  PositionEntry positionEntry = positionFeed.getEntries().get(i);
//  //  printPositionEntry(positionEntry);
  


//        }
//        [Test]
//        public void GetPortfolio()
//        {
//            DataTable dt = new DataTable();
//            try
//            {
//                SpreadsheetsService service = new SpreadsheetsService("STOCK-LOOKUP");
//                service.setUserCredentials("YOUR GMAIL ACCOUNT", "YOUR PASS");
//                SpreadsheetQuery query = new SpreadsheetQuery();
//                query.Title = "STOCK_LOOKUP_DEMO";
//                SpreadsheetFeed feed = service.Query(query);
//                if (feed.Entries.Count != 1) return;


//                AtomLink link = feed.Entries[0].Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);
//                WorksheetQuery worksheetQuery = new WorksheetQuery(link.HRef.ToString());
//                worksheetQuery.Title = "Sheet1";
//                WorksheetFeed worksheetFeed = service.Query(worksheetQuery);
//                if (worksheetFeed.Entries.Count != 1) return;


//                WorksheetEntry worksheet = (WorksheetEntry)worksheetFeed.Entries[0];


//                AtomLink listFeedLink = worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);


//                ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());
//                ListFeed listFeed = service.Query(listQuery);
//                // define the table's schema 
//                dt.Columns.Add(new DataColumn("Stock", typeof(string)));
//                dt.Columns.Add(new DataColumn("High", typeof(string)));
//                dt.Columns.Add(new DataColumn("Low", typeof(string)));
//                foreach (ListEntry worksheetRow in listFeed.Entries)
//                {
//                    string station = string.Empty;
//                    string scanData = worksheetRow.Elements[0].Value.ToString();
//                    string scanData1 = worksheetRow.Elements[1].Value.ToString();
//                    string scanData2 = worksheetRow.Elements[2].Value.ToString();
//                    string[] arSD = new string[100];


//                    DataRow dr = dt.NewRow();
//                    dr["Stock"] = scanData;
//                    dr["High"] = scanData1;
//                    dr["Low"] = scanData2;


//                    dt.Rows.Add(dr);


//                }


//                //GridView1.DataSource = dt;
//                //GridView1.DataBind();
//                //Page.DataBind();
//            }


//            catch (Exception ex)
//            {
//                Debug.Assert(false, "Error in GetPortfolio: " + ex.Message);
//            }
//        }

//    }


//}